package cn.yunhe.servlet;

import cn.yunhe.bean.Area;
import cn.yunhe.bean.SceType;
import cn.yunhe.biz.AreaService;
import cn.yunhe.biz.SceTypeService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/GetSceTypeAndSceAreaServlet")
public class GetSceTypeAndSceAreaServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<SceType> sceTypeList = SceTypeService.getAllSceType();
        List<Area> areaList = AreaService.getAllArea();
        request.setAttribute("sceTypeList",sceTypeList);
        request.setAttribute("areaList",areaList);
        request.getRequestDispatcher("adminPage.jsp").forward(request,response);
    }
}
